package com.jd.basic.controller;

import com.jd.basic.service.IVerifyCodeService;
import com.jd.basic.util.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/verifyCode")
public class VerifyCodeController { // 验证码的接口
    @Autowired
    private IVerifyCodeService verifyCodeService;

    @GetMapping("/image/{key}")
    public AjaxResult verifyCodeImage(@PathVariable("key") String key){ // 图片验证码
        return verifyCodeService.verifyCodeImage(key);
    }

    @PostMapping("/phone")
    public AjaxResult verifyCodePhone(@RequestBody Map<String,String> map){ // 手机验证码
        return verifyCodeService.verifyCodePhone(map);
    }
    /**
     * 扫码绑定手机号
     * @param map
     * @return
     */
    @PostMapping("/binderSmsCode")
    public AjaxResult binderSmsCodePhone(@RequestBody Map<String, String> map){ // 手机绑定验证码
        return verifyCodeService.binderSmsCodePhone(map);
    }
}
